<template>
  <div>这是爸爸组件----{{ state.dataByson }}</div>
  <!-- 监听子组件传递过来的事件 -->
  <Erzi @sendMsg="getSondata"></Erzi>
</template>

<script>
import { reactive, defineComponent } from "vue";
import Erzi from "./Erzi";
export default defineComponent({
  components: {
    Erzi,
  },
  setup() {
    const state = reactive({
      dataByson: "",
    });

    // 监听子组件传递过来的参数的函数
    const getSondata = (value) => {
      state.dataByson = value;
    };
    return {
      state,
      getSondata,
    };
  },
});
</script>

<style></style>
